package com.zlf.mapper;

import com.zlf.po.Wallet;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface WalletMapper {
    @Select("select * from wallet where id=#{walletId}")
    public Wallet getWallet(Long walletId);
    @Insert("Insert into wallet (id,createTime, balance, isAllowedOverdraft, overdraftAmount, frozenAmount,payPassword) values (#{id},#{createTime}, #{balance}, #{isAllowedOverdraft}, #{overdraftAmount}, #{frozenAmount},#{payPassword})")
    public int createWallet(Wallet wallet);
    @Update("update wallet set balance=#{balance} " +
            ", isAllowedOverdraft=#{isAllowedOverdraft} " +
            ", overdraftAmount=#{overdraftAmount} " +
            ", frozenAmount=#{frozenAmount} " +
            "where id=#{id}")
    public void updateWallet(Wallet wallet);

    @Select("SELECT * from wallet")
    public List<Wallet> listWallet();
}
